home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 August
/
Macworld (1997-08).dmg
/
Shareware World
/
Info
/
For Developers
/
InstallerMaker™ 4.0 Installer
/
Customizing InstallerMaker
/
Sample Code
/
Utilities
/
ParsePkgBits.cp
< prev
next >
Wrap
Text File
|
1995-08-03
|
3KB
|
107 lines
// Demo routine that shows you how to for dealing with 3.0 package bits.
// We don't recommend you use this for anything except for learning how
// to play with packages in IM 3.0
// Copyright© 1994-1995 Aladdin Systems, inc.
// 12/30/94 RMT; revised 8/3/95 RMT
/**
Packages field
==============
The interpretation of packages for the code rsrcs is:
IM 2.0: packages should be interpreted as a 16 bit field. Bit 0 is the lowest bit.
IM 3.0: packages should be interpreted as a 128 bit field. packages[0] contains
bits 0-31 where 0 is the lowest bit. packages[1] contains bits 32-63 where
32 is the lowest bit. Similarly for packages[2] and packages[3].
packages is a bit mask where bit 0 set means std pkg, bit 1 set means pkg A,
bit 2 means B, etc. For compatibility, a value of zero is synonymous with all ones.
The packages field typically specifies the currently selected pkgs unless otherwise
noted.
***/
#include <IOStream.h>
#include "IMPackages.h"
void main ()
{
StringPtr aStr = "\pSTD" , bStr = "\p" ,
cStr = "\pa", dStr = "\pz", eStr = "\pAA",
fStr = "\pAZ", gStr = "\pBB", hStr = "\pDW" ;
char store [40] ;
cout << "Initialize\n" ; // This makes sure that your compiler generates
// Toolbox initialization calls.
short i ;
char bigStore [500] ;
long package [4] ;
package [0] = 0 ;
package [1] = 0 ;
package [2] = 0 ;
package [3] = 0 ;
cout << "0 " << GetPkgLetters ( 0, store ) << '\n' ;
cout << "1 " << GetPkgLetters ( 1, store ) << '\n' ;
for ( i= -1 ; i< 140; i+=10 )
{
cout << i << ": " << GetPkgLetters ( i, store ) << '\n' ;
SetPackageBit ( package, i , true ) ; // turn on this bit
}
cout << "What's set? " <<
ConstructPkgString ( package, bigStore ,sizeof (bigStore)) << '\n' ;
for ( i = 12 ; i < 18 ; i++ )
cout << "What if we're shorter? (" << i << ")" <<
ConstructPkgString ( package, bigStore ,i) << '\n' ;
package [0] = 1 ;
package [1] = 2 ;
package [2] = 7 ;
package [3] = 1 << 31 ;
cout << "1 << 10 " << package [3] << '\n' ;
cout << "Is Bit 33 set? " << GetPackageBit ( package, 33)
<< " (" << package [1] << ") " << '\n' ;
SetPackageBit ( package, 33, false );
cout << "Is Bit 33 set now? " << GetPackageBit ( package, 33)
<< " (" << package [1] << ") " << '\n' ;
SetPackageBit ( package, 33, true );
cout << "Is Bit 33 set now? " << GetPackageBit ( package, 33)
<< " (" << package [1] << ") " << '\n' ;
cout << "What's set? " <<
ConstructPkgString ( package, bigStore ,sizeof (bigStore)) << '\n' ;
cout << "Done.\n" ;
}